package com.qfedu.openplateform.manager.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qfedu.openplateform.manager.dao.CustomerMapper;
import com.qfedu.openplateform.manager.entity.AdminUser;
import com.qfedu.openplateform.manager.entity.Customer;
import com.qfedu.openplateform.manager.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class CustomerServiceImpl implements CustomerService {

    @Autowired
    private CustomerMapper customerMapper;

    @Override
    public PageInfo<Customer> getCustomerList(Customer customer, Integer page, Integer pageSize) {
        PageHelper.startPage(page, pageSize);
        return new PageInfo<>(customerMapper.getCustomerList(customer));
    }

    @Override
    public List<Customer> getCustomerTree() {
        return customerMapper.getCustomerList(null);
    }

    @Override
    public Customer customerId(Integer id) {
        return customerMapper.getCustomerById(id);
    }


    @Override
    public List<Integer> getCustomerRoleIds(Integer customerId) {
        return null;
    }

    @Override
    public void addCustomer(Customer customer) {
        customerMapper.addCustomer(customer);
    }

    @Override
    public void updateCustomer(Customer customer) {
        customerMapper.updateCustomer(customer);
    }

    @Override
    public Customer getCustomerById(Integer id) {
        return customerMapper.getCustomerById(id);
    }

    @Override
    public void deleteCustomer(Integer[] ids) {
        customerMapper.deleteCustomer(ids);
    }

}
